from PDBC import ScoreAnalysisSystem

if __name__ == '__main__':
    # 创建 ScoreAnalysisSystem 实例
    system = ScoreAnalysisSystem('127.0.0.1', 'root', '666666', 'scoreAnalysisSystem')
    # 调用函数
    '''删除表中原有数据'''
    system.delete_all_tables()
    '''向表中添加数据'''
    system.join_data_excel()

    # 一个班某几科单次考试成绩
    exam_ids = ['202111100001', '202111200001']
    class_id = '11101101'
    df_result = system.get_class_scores_by_exam(exam_ids, class_id)
    print(df_result)

    # 一个班某一科多次考试成绩
    exam_course = '数学'
    class_id = '11101101'
    df_result = system.get_student_scores_by_exam_course(class_id, exam_course)
    print(df_result)

    # 一个同学多次考明细
    student_id='20210010101'
    df_result = system.get_student_scores_by_id(student_id)
    print(df_result)

    # 一个学生所在班级所有成绩
    student_id = '20210010101'
    df_result = system.get_class_scores_by_student(student_id)
    print(df_result)

    #一个班级内所有成绩情况
    class_id = '11101101'
    df_result = system.get_all_scores_by_class(class_id)
    print(df_result)
    # 关闭数据库连接
    system.cursor.close()
    system.db.commit()
    system.db.close()
